<template>
  <swiper>
    <swiper-item v-for="item in banner">
      <a class="swiper-a" :href="item.link">
        <img @load="swiperImageLoad" class="swiper-img" :src="item.image" alt=""></a>
    </swiper-item>
  </swiper>
</template>

<script>
  import {Swiper, SwiperItem} from 'components/common/swiper'

  export default {
    name: "HomeSwiper",
    components: {
      Swiper, SwiperItem
    },
    props: {
      banner: {
        type: Array,
        default() {
          return []
        }
      }
    },
    data() {
      return {
        isLoad: true
      }
    },
    methods: {
      swiperImageLoad() {
        if (this.isLoad) {
          this.$emit("swiperImageLoad");
          this.isLoad = false;
        }
      }
    },
  }
</script>

<style scoped>
  .swiper-a {
    width: 100%;
    display: inline-block;
  }

  .swiper-img {
    vertical-align: bottom
  }
</style>
